package com.ll.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class UserCheckService
{
	public static boolean isExist(String cUsername) throws Exception
	{
		//如果系统错误， 导致所有账号已注册
		boolean isExist = true;
		
		Connection con = DB.getConnection();
		
		PreparedStatement st = 
				con.prepareStatement("select count(*) from t_manager_user where username=?");
		st.setString(1, cUsername);
		
		ResultSet rs = st.executeQuery();
		while(rs.next())
		{
			int count = rs.getInt(1);
			
			if(count == 0)
			{
				isExist = false;
			}
		}
		
		return isExist;
	}
}
